package gp.app;

import genetic.GPApplication;

import java.awt.Graphics;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JFrame;

@SuppressWarnings("serial")
public class GPTreeView extends JFrame implements Observer {

	private GPApplication app;
	
	@Override
	public void update(Graphics arg0) {
		this.getGraphics().drawImage(
				app.getCurrentGPTreeImage(), 0, 0, null);
		super.update(arg0);
	}

	public GPTreeView(GPApplication app) {
		super("GPTreeView");
		this.app = app;
		app.addObserver(this);
		
		this.setSize(512, 512);
		this.setLocation(510, 10);
		this.setResizable(false);
		// this.setVisible(true);
	}

	@Override
	public void update(Observable arg0, Object arg1) {
		this.getGraphics().drawImage(
				app.getCurrentGPTreeImage(), 0, 0, null);
	}
}
